﻿namespace FFF.Test.Entity.Demo.Proc
{
    using System;
    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.IO;
    using System.Data;
    using System.Text;
    using Microsoft.Extensions.Configuration;
    using FFF.Test.Util.Configuration;
    using FFF.Test.Entity.Framework.Proc;
    using FFF.Test.Util.Consts;
    using Ydm.Helper;

	/// <summary>
    /// usp_Demo_GetDemoStudent存储过程
    /// </summary>
    public class UspDemoGetDemoStudent : BaseProc
    {        
        /// <summary>
        /// @StuName
        /// </summary>
        public string StuName { get; set; } 
        
        /// <summary>
        /// @OutCount
        /// </summary>
        public int OutCount { get; set; } 
        
        /// <summary>
        /// 设置参数的集合
        /// </summary>
        /// <returns>参数集合</returns>
        public override SqlParameter[] GetSqlParameters()
        {
            List<SqlParameter> parameters = new List<SqlParameter>();
            parameters.Add(new SqlParameter("@StuName", this.StuName));
            var paramOutCount = new SqlParameter("@OutCount", SqlDbType.Int);
            paramOutCount.Direction = ParameterDirection.Output;
            parameters.Add(paramOutCount);
            return parameters.ToArray();
        }

        /// <summary>
        /// 获取sql
        /// </summary>
        /// <returns>获取sqlstr</returns>
        public override string GetSql()
        {
            string sql = "EXEC dbo.usp_Demo_GetDemoStudent ";
            sql += " @StuName = @StuName,";
           
            sql += " @OutCount = @OutCount OUT,";
           
            sql = sql.Substring(0, sql.Length - 1);
            return sql;
        }
    }
}
